﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using System.Web.Profile;
using IronOne.SalesOne.BusinessObjects;
using System.Configuration;
using Facade;
using System.Collections;
using System.Data;

namespace IronOne.SalesOne.SalesOneWeb.CustomerServices
{
    public partial class ViewClaimDetails : SOSecurityPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                ValidateUserCredentials(Request.Url.LocalPath);

                if (!IsPostBack)
                {
                    ViewState["refUrl"] = Request.UrlReferrer.ToString();

                    CodeFacade fac = new CodeFacade();
                    List<ClaimStatus> cs = fac.GetClaimStatuss("CodeId ASC", 1);
                    ClaimStatus cs1 = new ClaimStatus();
                    cs1.CodeId = -1;
                    cs1.Description = "Select";
                    cs.Insert(0, cs1);
                    drpStatus.DataSource = cs;
                    drpStatus.DataValueField = "CodeId";
                    drpStatus.DataTextField = "Description";
                    drpStatus.DataBind();
                }

                if (Session["ClaimRow"] != null)
                {
                    GridViewRow clRow = (GridViewRow)Session["ClaimRow"];
                    lblClaimNo.Text = clRow.Cells[2].Text;
                    lblSoCode.Text = clRow.Cells[3].Text;
                    lblContractNo.Text = clRow.Cells[4].Text;
                    lblClientName.Text = clRow.Cells[5].Text;
                    lblAssignedDate.Text = clRow.Cells[9].Text;
                    lblReplyDate.Text = clRow.Cells[10].Text;
                    lblPendingReason.Text = clRow.Cells[7].Text;

                    drpStatus.SelectedValue = drpStatus.Items.FindByText(clRow.Cells[8].Text).Value;
                    //drpStatus.SelectedItem.Text = clRow.Cells[8].Text;

                    lbRemarks.Text = clRow.Cells[11].Text;

                    Session.Remove("ClaimRow");

                }
            }
            catch (Exception)
            {

            }
            

            



        }

        protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        protected void cancelButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (ViewState["refUrl"] != null)
                {
                    Response.Redirect(ViewState["refUrl"].ToString());
                }
            }
            catch (Exception)
            {

            }
           
        }
    }
}
